/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pt.utl.ist.isr.livetrack.ui;

import java.util.List;
import org.openide.nodes.ChildFactory;
import org.openide.nodes.Node;
import pt.utl.ist.isr.livetrack.server.LTServer;

/**
 *
 * @author David Miguel Antunes <davidmiguel [ at ] antunes.net>
 */
public class ServerNodeChildFactory extends ChildFactory<Integer> {

    LTServer server;

    public ServerNodeChildFactory(LTServer server) {
        this.server = server;
    }

    @Override
    protected Node createNodeForKey(Integer key) {
        switch (key) {
            case 1:
                return new CamerasNode(server);
            case 2:
                return new ZonesNode(server);
            case 3:
                return new TrackerNode(server);
        }
        return null;
    }

    @Override
    protected boolean createKeys(List<Integer> toPopulate) {
        toPopulate.add(1);
//        toPopulate.add(2);
//        toPopulate.add(3);
        return true;
    }

    public void refresh() {
        super.refresh(true);
    }
}
